package org.fisco.bcos.asset.controller;


import java.math.BigInteger;

import org.fisco.bcos.asset.resp.DonationSummary;
import org.fisco.bcos.asset.service.BeneficiaryService;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/beneficiary")
public class BeneficiaryController {

    @Autowired
    private BeneficiaryService beneficiaryService;
    // 提交申请
    @PostMapping("/application")
    public void submitApplication(
            @RequestParam String description,
            @RequestParam BigInteger requestedAmount) {
        beneficiaryService.submitApplication(description, requestedAmount);
    }
    // 获取申请详情
    @GetMapping("/{address}/stats")
    public DonationSummary getBeneficiaryStats(
            @PathVariable String address) {
        return beneficiaryService.getBeneficiaryStats(address);
    }
}